#include "cdbcalendar.h"

#include "ccalmanager.h"
#include "sql_bind.h"

namespace buola { namespace bcal {

CDBCalendar::CDBCalendar(CCalManager *pManager,int pID)
    :   mManager(pManager)
//    ,   mID(pID)
{
    CDBQuery *lQ=&mManager->mQueries.mGetCalendar;
    lQ->BindInteger(BIND_GETCALENDAR_ID,pID);

    lQ->Exec();
    if(!lQ->NextRow())
        throw XNotFound("calendar not found in CDBCalendar::CDBCalendar");

    mName=utf32(lQ->ColumnString(1));
    mColor=img::CColor((uint32_t)lQ->ColumnInteger(4));

    lQ->Reset();
}

CDBCalendar::~CDBCalendar()
{
}

img::CColor CDBCalendar::GetColor()
{
    return mColor;
}

CCalendar::EType CDBCalendar::GetType()
{
    return TYPE_LOCAL;
}

std::wstring CDBCalendar::GetName()
{
    return mName;
}

/*namespace buola*/ } /*namespace bcal*/ }
